package com.zzjson.mongodb.native_demo;


import com.mongodb.*;

/**
 * <p>****************************************************************************</p>
 * <p><b>Copyright © 2010-2019 shuncom team All Rights Reserved<b></p>
 * <ul style="margin:15px;">
 * <li>Description : cn.zzjson.mongodb.native_demo</li>
 * <li>Version     : 1.0.0</li>
 * <li>Creation    : 2019年04月02日</li>
 * <li>@author     : zzy0_0</li>
 * </ul>
 * <p>****************************************************************************</p>
 */
public class NativeTest {

    public static void main(String[] args) {

        Mongo mongo = new Mongo("127.0.0.1", 27017);
        //    建立连接
        DB db = new DB(mongo, "mydb");
        //System.out.println(db.getCollectionNames());
        DBCollection myNewCollection1 = db.getCollection("myNewCollection1");
        DBCursor dbObjects = myNewCollection1.find();
        while (dbObjects.hasNext()) {
            DBObject dbObject = dbObjects.next();
            System.out.println(dbObject);
        }

    }


}